<?php
/**
 * Base Tag to News reference model
 *
 * PHP version 5
 *
 * @category   Web
 * @package    Data2People
 * @subpackage Models
 * @author     Mike Bevz <mike.bevz@data2people>
 * @copyright  2007-2008 (c) Mike Bevz
 * @license    The BSD License http://data2people.com/license.txt
 * @version    SVN: $Id: BaseWordRefNews.php 13 2008-12-01 16:16:50Z michael.bevz $
 *
 *
 */

/**
 * Includes
 */
require_once 'Doctrine/Record.php';

/**
 * Base Tag to News reference model class
 *
 * PHP version 5
 *
 * @category   Web
 * @package    Data2People
 * @subpackage Models
 * @author     Mike Bevz <mike.bevz@data2people>
 * @copyright  2007-2008 (c) Mike Bevz
 * @license    The BSD License http://data2people.com/license.txt
 * @version    SVN: $Id: BaseWordRefNews.php 13 2008-12-01 16:16:50Z michael.bevz $
 *
 *
 */
abstract class BaseWordRefNews extends Doctrine_Record
{
    public function setTableDefinition()
    {
        $this->setTableName('word_ref_news');
        $this->hasColumn('word_id', 'integer', 4, array('primary' => true, 'unsigned' => true));
        $this->hasColumn('news_id', 'integer', 4, array('primary' => true, 'unsigned' => true));

        $this->option('type', 'INNODB');
        $this->option('collate', 'utf8_unicode_ci');
        $this->option('charset', 'utf8');
    }
    
    public function setUp()
    {
        $this->hasOne('Word',
                        array('local'   => 'word_id',
                              'foreign' => 'id',
                              'onDelete' => 'CASCADE',
                              'onUpdate'=> 'CASCADE'));
        $this->hasOne('News',
                        array('local'   => 'news_id',
                              'foreign' => 'id',
                              'onDelete' => 'CASCADE',
                              'onUpdate'=> 'CASCADE'));
    }
}
